#ifndef _I_ANALYST_H
#define _I_ANALYST_H

#ifdef ANALYST_EXPORTS
#define ANALYST_API __declspec(dllexport)
#else
#define ANALYST_API __declspec(dllimport)
#endif

#include "Analyst.h"

//////////////////////////////////////////////////////////////////////////
class Scop_Analyst_Helper
{
public:
	Scop_Analyst_Helper(int iIdx,const char* szName)
	{
		Analyst()->AnalystAdd(iIdx, ANALYST_MASK_TICKS, szName);
	}
};

#define	TICK_ANALYST_INTERVAL(x,interval)		CTickAnalyst _analyst##x(x,interval)
#define TICK_SCOPE_ANALYST_INTERVAL(x,interval)\
	static Scop_Analyst_Helper _analystHelper##x(x,#x);\
	TICK_ANALYST_INTERVAL(x,interval);

#define	TICK_SCOPE_ANALYST(x)		TICK_SCOPE_ANALYST_INTERVAL(x,0)

class ANALYST_API CTickAnalyst
{
public:
	CTickAnalyst(int nIdx, int nIntervalTime = 0);
	~CTickAnalyst();		
public:
	void	Start();
	void	Finish();
	int		GetUsedTicks();
	int		GetUsedMS();
private:
	unsigned int	_tickStart;
	unsigned int	_tickEnd;
	int				_analystIdx;
	int				_intervalTime;
	
};

class ANALYST_API CTickCount
{
public:
	void	Start();		
	void	Finish();		
	int		GetUsedTicks();	
	int		GetUsedMS();	
private:
	unsigned int	tick_start;
	unsigned int	tick_end;
};

extern  ANALYST_API CAnalyst* Analyst();


#endif